//
//  ViewController.m
//  24-加密
//
//  Created by Snow on 16/8/16.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "ViewController.h"
#import "NSString+GXMD5.h"
#import "NSString+GXSHA_1.h"
#import "NSString+GXBase64.h"
#import "NSString+GXDES.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *afterMD5 = @"Hello";
    //1.MD5 验证算法 一般用于验证密码 单向散列函数, 算法(包括SHA_1)
    NSString *final32MD5Lower = [afterMD5 stringWith32BitMD5Lower];
    NSString *final32MD5Upper = [afterMD5 stringWith32BitMD5Upper];
    NSString *final16MD5Lower = [afterMD5 stringWith16BitMD5Lower];
    NSString *final16MD5Upper = [afterMD5 stringWith16BitMD5Upper];

    NSLog(@"加密32位小写:%@", final32MD5Lower);
    NSLog(@"加密32位da写:%@", final32MD5Upper);
    NSLog(@"加密16位小写:%@", final16MD5Lower);
    NSLog(@"加密16位大写:%@", final16MD5Upper);
//  2.SHA-1
    NSString *afterSHA_1 = @"Hello";
    NSString *sha = [afterSHA_1 stringWithSHA_1];
    NSLog(@"SHA-1 : %@", sha);
    
    //3.base64
    NSString *str = @"hello";
    NSString *base64 = [str stringWithBase64];
    NSLog(@"base64 : %@", base64);
    NSString *finalString = [base64 Base64WithString];
    NSLog(@"final 64 : %@", finalString);
    
    //4.对称密码
    //三种算法 DES 3重DES AES
    NSString *strin = @"1234567";
    NSString *desString = [strin stringWithDES];
    NSLog(@"%@", desString);
    NSString *datastring = [desString desWithString];
    NSLog(@"uuuuu%@", datastring);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
